/**
 * generates a list of messages of length k with weight j
 *
 * @list list of vectors, Note: memory must be preallocated for the list of size [k choose j,k]
 * @k	length of messages 
 * @j	weight
 *
 * @return size of the list
 *
 **/
int msg_generator(vec_ZZ_pE* list,int k,int j,int horizontal_index=0,int vertical_index=0)
{
	ZZ_p p_ONE;
	set(p_ONE); // p_ONE = 1
	int size = list[0].length();
	int kChoosej= nChoosek(k,j);
	int vertical_stop_index = vertical_index+kChoosej;
	if( kChoosej ==1 ) 
	{
		if( k == j )
		{
			for(int i=horizontal_index;i<size;i++)
				list[vertical_index][i]= p_ONE; // set element to 1
		}
		return(vertical_index+1);
	}
	while(vertical_index<vertical_stop_index)
	{
		int updated_vertical_index = msg_generator(list,k-1,j-1,horizontal_index+1,vertical_index);
		for(;vertical_index<updated_vertical_index;vertical_index++)
			list[vertical_index][horizontal_index]=p_ONE;
		horizontal_index++;	
		k--;
	}
	return vertical_index;
}
